import {getPost} from '../request'

const startRequest = () =>{
    return {
        type: 'startRequest'
    }
}
const requestSuccess = (payLoady) => {
    return {
        type: 'requestSuccess',
        payLoady
    }
}
const requestFaile = (error) => {
    return {
        type: 'requestFaile',
        error
    }
}
export const fetchList = () => dispath =>{
    dispath(startRequest())
    getPost()
        .then(res => {
            console.log(res)
            dispath(requestSuccess(res.data))
        }).
        catch(error=> {
            dispath(requestFaile(error))
        })

}